<?
/**
* Copyright (c) 2002-2007 BioWare Corp.
* http://www.bigdaddymonitor.org
*
* This file is part of the BigDaddy Monitoring
* program. It is free software distributed under
* the terms of the BSD License. It is ditributed
* in the hopes that it will be useful, but
* WITHOUT ANY WARRANTY; without event the implied
* warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE.
*
* The BSD License is available from:
* http://www.opensource.org/licenses/bsd-license.php
**/
if (GRAPH_TYPE == "plotkit")
{
	?>
    <script language="javascript" type="text/javascript" src="/_common/js/mochikit/MochiKit.js"></script>        
	<script language="javascript" type="text/javascript" src="/_common/js/plotkit/excanvas.js"></script>        
	<script language="javascript" type="text/javascript" src="/_common/js/plotkit/Base.js"></script>        
	<script language="javascript" type="text/javascript" src="/_common/js/plotkit/Layout.js"></script>        
	<script language="javascript" type="text/javascript" src="/_common/js/plotkit/Canvas.js"></script>        
	<script language="javascript" type="text/javascript" src="/_common/js/plotkit/SweetCanvas.js"></script>
    <?
}

	$aGraph = array (
		"Last Hour", "Last 24 Hours", "Last 3 Days", "Last 7 Days", "Last 30 Days", "Last 180 Days (6 Months)", "Last Year"
	);
	
	
	$i=1;
	foreach ($aGraph as $sGraph)
	{
        if (GRAPH_TYPE == "plotkit")
        {
            $aInfo["serverModuleID"]= $_REQUEST["ID"];
            $aInfo["serverID"] = $_REQUEST["serverID"];
            $aInfo["modID"] = $_REQUEST["modID"];
            $aInfo["type"]=$i;
            
            $data = $BigDaddyData->GetPlotKitData("ServerModuleHistoryNonBooleanGraph", $aInfo);
            ?>
            <script language="javascript">
            
              
            function drawGraph<?=$i;?>()
            {
                var options = {
                    "IECanvasHTC": "/plotkit/iecanvas.htc",
                    "xTicks": [<?=$data["xTicks"];?>]
                
                };
                var layout = new PlotKit.Layout("line", options);
                var dataset = new Array();
            
                dataset = [<?=$data["dataset"];?>];
            
                layout.addDataset("graph<?=$i;?>", dataset);
                layout.evaluate();
                var canvas = MochiKit.DOM.getElement("graph<?=$i;?>");
                var plotter = new PlotKit.SweetCanvasRenderer(canvas, layout,options);
                plotter.render();
            }
            
            MochiKit.DOM.addLoadEvent(drawGraph<?=$i;?>);
            </script>
            <p><b><?=$aModule["module_name"];?> <?=$data["title"];?></b></p>
            
            <div><canvas id="graph<?=$i;?>" height="300" width="800"></canvas></div>
            <?
        }
        else if (GRAPH_TYPE == "jpgraph")
        {
?>
        <p style="font-size: 12pt;border-bottom: 1px solid #aaa;padding-bottom: 5px;"><b><?=$sGraph;?></b></p>
        <img src="<?=$_SERVER["PHP_SELF"]."?page=ServerModuleHistoryNonBooleanGraph&serverModuleID=".$_REQUEST["ID"]."&serverID=".$_REQUEST["serverID"]."&modID=".$_REQUEST["modID"]."&type=$i";?>" />
        <br>
        <?
        }
            $i++;
	}

?>
